using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TanashCMS.Business;

public partial class signin : CMSPageBase
{
    protected override void OnInit(EventArgs e)
    {
//        if (mWebsite.getOptionValue("AuthCookieDomain") != "")
            //FormsAuthentication.CookieDomain = mWebsite.getOptionValue("AuthCookieDomain");

        Login1.LoggingIn += new LoginCancelEventHandler(Login1_LoggingIn);
        Login1.LoggedIn += new EventHandler(Login1_LoggedIn);

        base.OnInit(e);
    }

    void Login1_LoggedIn(object sender, EventArgs e)
    {
        if (mWebsite.getOptionValue("AuthCookieDomain") != "")
        {
            // need to create our own FAT
            HttpCookie C = FormsAuthentication.GetAuthCookie(Login1.UserName, Login1.RememberMeSet);
            C.Domain = mWebsite.getOptionValue("AuthCookieDomain");
            Response.AppendCookie(C);
            //Response.Redirect(System.Web.Security.FormsAuthentication.GetRedirectUrl(UserName, False))
        }
    }

    void Login1_LoggingIn(object sender, LoginCancelEventArgs e)
    {
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (mOptions.ContainsKey("CreateUserURL"))
            Login1.CreateUserUrl = mOptions["CreateUserURL"];
        if (mOptions.ContainsKey("CreateUserText"))
            Login1.CreateUserText = mOptions["CreateUserText"];
    }
}
